@model ToDo.Models.ItemsListViewModel
@{
    ViewData["Title"] = "ShowItems";
}

<link href="~/css/Inventory.css" rel="stylesheet" />
<script src="~/js/index.js"></script>
<script src="~/js/bootbox.js"></script>
<table id="content">
    <tr>
        <td id="content-block1">
            <div class="color-block" id="block1">
                <b>清单</b>
                <div id="myimg" onclick="viewCreateInventory()" style="display:inline-block">
                    <img class="add" src="~/images/添加.png" alt="图标" />
                </div>
            </div>
            <div id="invnetory-block">
                <ul>
                    @for (int i = 0; i < Model.allInventorys.Count; i++)
                    {
                        <li class="input-li">
                            <div class="circle" onclick="showInventoryItems(@Model.allInventorys[i].InventoryId)">
                                <label class="radio">
                                    <input type="radio" name="radio" value="1"><i></i>
                                </label>
                            </div>
                            <a href="/Inventory/ViewModifyInventoryName?inventoryId=@Model.allInventorys[i].InventoryId" title="修改清单">
                                <span class="input-inventory-name">@Model.allInventorys[i].InventoryName</span>
                            </a>
                            <span class="input-inventory-time">@Model.allInventorys[i].CreateTime.Month/@Model.allInventorys[i].CreateTime.Day&nbsp;&nbsp;@Model.allInventorys[i].CreateTime.Hour:@Model.allInventorys[i].CreateTime.Minute</span>
                            <a onclick="deleteInventory(@Model.allInventorys[i].InventoryId)" data-toggle="modal" data-target="#myModal">
                                <img src="~/images/主删除.png" alt="图标" class=" remove-icon" />
                            </a>
                        </li>
                    }
                </ul>
            </div>
            <div class="modal fade" id="myModal">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title" id="myModalLabel">
                                你确定要删除吗？
                            </h4>
                        </div>
                        <div class="modal-footer">
                            <input type="hidden" name="inventoryId" id="inventoryId" />
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                取消
                            </button>
                            <button type="button" class="btn btn-primary" onclick="DeleteInventory()">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </td>
        <td id="content-block2">
            <div class="color-block" id="block2">
                <b>未完成事项</b>
                <a href="/Item/AddItem?inventoryId=@Model.InventoryId">
                    <img class="add" src="~/images/添加.png" alt="图标" />
                </a>
            </div>
            <ul>
                @foreach (var item in Model.noFinished)
                {
                    <li class="input-li">
                        <a onclick="ChangeStatue(@item.ItemId,@item.ItemOfInventoryId)">
                            <div class="circle">
                                <label class="radio">
                                    <input type="radio" name="radio" value="1"><i></i>
                                </label>
                            </div>
                        </a>
                        <a href="/Item/ChangeItem?itemId=@item.ItemId&isReturnHomePage=true" title="修改事项">
                            <span class="input-inventory-name">@item.Content</span>
                        </a>
                        <span class="input-inventory-time">@item.CreateTime.Month/@item.CreateTime.Day  @item.CreateTime.Hour:@item.CreateTime.Minute</span>
                        <a onclick="deleteItemInInventory(@item.ItemId,@item.ItemOfInventoryId)" data-toggle="modal" data-target="#deleteItemInInventoryModel">
                            <img src="~/images/主删除.png" class="remove-icon" />
                        </a>
                    </li>
                }
            </ul>
            <div class="modal fade" id="deleteItemInInventoryModel">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h4 class="modal-title" id="myModalLabel">
                                你确定要删除吗？
                            </h4>
                        </div>
                        <div class="modal-footer">
                            <input type="hidden" name="itemId" id="itemId" />
                            <input type="hidden" name="inventoryId" id="inventoryId" />
                            <button type="button" class="btn btn-default" data-dismiss="modal">
                                取消
                            </button>
                            <button type="button" class="btn btn-primary" onclick="DeleteItem()">
                                确定
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <td id="content-block3">
            <div class="color-block" id="block3">
                <b>完成事项</b>
            </div>
            <ul>
                @foreach (var item in Model.hasFinished)
                {
                    <li class="input-li">
                        <a onclick="ChangeStatue(@item.ItemId,@item.ItemOfInventoryId)">
                            <div class="circle">
                                <label class="radio">
                                    <input type="radio" name="radio" value="1"><i></i>
                                </label>
                            </div>
                        </a>
                        <a href="/Item/ChangeItem?itemId=@item.ItemId&isReturnHomePage=true" title="修改事项">
                            <span class="input-inventory-name">@item.Content</span>
                        </a>
                        <span class="input-inventory-time">@item.CreateTime.Month/@item.CreateTime.Day  @item.CreateTime.Hour:@item.CreateTime.Minute</span>
                        <a onclick="deleteItemInInventory(@item.ItemId,@item.ItemOfInventoryId)" data-toggle="modal" data-target="#deleteItemInInventoryModel">
                            <img src="~/images/主删除.png" class="remove-icon" />
                        </a>
                    </li>
                }
            </ul>
        </td>
        <td id="content-block4">
            <div class="color-block" id="block4">
                <b>过期事项</b>
            </div>
            <ul>
                @foreach (var item in Model.hasOverdue)
                {
                    <li class="input-li">
                        <input type="radio" name="R1" onclick="test(this)">
                        <a href="/Item/ChangeItem?itemId=@item.ItemId&isReturnHomePage=true" title="修改事项">
                            <span class="input-inventory-name">@item.Content</span>
                        </a>
                        <span class="input-inventory-time">@item.CreateTime.Month/@item.CreateTime.Day  @item.CreateTime.Hour:@item.CreateTime.Minute</span>
                        <a onclick="deleteItemInInventory(@item.ItemId,@item.ItemOfInventoryId)" data-toggle="modal" data-target="#deleteItemInInventoryModel">
                            <img src="~/images/主删除.png" class="remove-icon" />
                        </a>
                    </li>
                }
            </ul>
        </td>
    </tr>
</table>
<script language=javascript>
    function test(radio) {
        radio.checked = false;
    }
</script>

